package com.zzccyy.jpdemo.utils;

import android.app.Activity;
import android.text.TextUtils;
import android.widget.TextView;

import androidx.core.content.ContextCompat;

import com.chad.library.adapter.base.BaseQuickAdapter;
import com.chad.library.adapter.base.BaseViewHolder;

import com.zzccyy.jpdemo.R;
import com.zzccyy.jpdemo.bean.AaaBean1;

import java.util.List;


public class AaaAdapter1 extends BaseQuickAdapter<AaaBean1.DataBean, BaseViewHolder> {


    private final Activity activity;


    public AaaAdapter1(Activity activity, int layoutResId, List<AaaBean1.DataBean> list) {
        super(layoutResId, list);
        this.activity = activity;
    }


    @Override
    protected void convert(BaseViewHolder helper, AaaBean1.DataBean item) {
        TextView ttt1 = helper.getView(R.id.ttt1);
        TextView ttt2 = helper.getView(R.id.ttt2);
        TextView ttt3 = helper.getView(R.id.ttt3);
        TextView ttt4 = helper.getView(R.id.ttt4);
        if (item.sequenceno.equals("1")){
            ttt1.setTextColor(ContextCompat.getColor(activity,R.color.color_5a79ff));
            ttt2.setTextColor(ContextCompat.getColor(activity,R.color.color_5a79ff));
            ttt3.setTextColor(ContextCompat.getColor(activity,R.color.color_5a79ff));
            ttt4.setTextColor(ContextCompat.getColor(activity,R.color.color_5a79ff));
        }else {
            ttt1.setTextColor(ContextCompat.getColor(activity,R.color.color_000000));
            ttt2.setTextColor(ContextCompat.getColor(activity,R.color.color_000000));
            ttt3.setTextColor(ContextCompat.getColor(activity,R.color.color_000000));
            ttt4.setTextColor(ContextCompat.getColor(activity,R.color.color_000000));
        }
        if (!TextUtils.isEmpty(item.station)) {
            ttt1.setText(item.station);
        }
        if (!TextUtils.isEmpty(item.arrivaltime)) {
            ttt2.setText(item.arrivaltime);
        }
        if (!TextUtils.isEmpty(item.departuretime)) {
            ttt3.setText(item.departuretime);
        }
        ttt4.setText(item.stoptime +"分钟");
    }
}

